
package slerp;

import java.io.Serializable;
import org.lwjgl.opengl.GL11;


public class Block extends Drawable implements Serializable {
    double x1;
    double y1;
    double width;
    double height;
    DColor c;
    Block() {
        
    }
    
    Block(double x, double x1, double y, double y1) {
        super(x, y);
        this.x1 = x1;
        this.y1 = y1;
        c = new DColor(1.f, 1.f, 1.f, 1.f);
        if(x1 > x) {
            width = x1 - x;
        }
        else if (x1 < x) {
            width = x - x1;
        }
        
        if(y1 > y) {
            height = y1 - y;
        }
        else if (y1 < y) {
            height = y - y1;
        }
        
    }
    
    @Override
    void debugPrint() {
        super.debugPrint();
        System.out.print(", x1: " + x1 + ", y1: " + y1 + ", width: " + width + ", height: " + height);
    }
    
    @Override
    public String toString() {
        return "Block object";
    }
    
    @Override
    void draw() {
        c.getColor();
        GL11.glBegin(GL11.GL_QUADS);
            GL11.glVertex2d(x, y);
            GL11.glVertex2d(x, y1);
            GL11.glVertex2d(x1, y1);
            GL11.glVertex2d(x1, y);
        GL11.glEnd();
    }
}
